package com.demo.handler.job;

import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @author : YU.TAN
 * @date : 2021/9/16 16:19
 */
@Component
@Slf4j
public class DemoJobHandler {

    int count = 1;
    @XxlJob("demoJobHandler")
    public void execute(String s) {
        log.info("开始执行");
//        Thread.sleep(20, TimeUnit.MINUTES);
        try {
            TimeUnit.MINUTES.sleep(20);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("hello,demoJobHandler执行job任务" + count++);
    }
}
